home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / smaltalk / gnu_st.lha / gnu_st / smalltalk-1.1.1 / stix / TextItem.st < prev    next >
Text File  |  1991-09-12  |  2KB  |  74 lines

  1. "======================================================================
  2. |
  3. | Copyright (C) 1990, 1991 Free Software Foundation, Inc.
  4. | Written by Steve Byrne.
  5. |
  6. | This file is part of GNU Smalltalk.
  7. |
  8. | GNU Smalltalk is free software; you can redistribute it and/or modify it
  9. | under the terms of the GNU General Public License as published by the Free
  10. | Software Foundation; either version 1, or (at your option) any later version.
  11. | GNU Smalltalk is distributed in the hope that it will be useful, but WITHOUT
  12. | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  13. | FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
  14. | details.
  15. | You should have received a copy of the GNU General Public License along with
  16. | GNU Smalltalk; see the file COPYING.  If not, write to the Free Software
  17. | Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  
  18. |
  19.  ======================================================================"
  20.  
  21.  
  22. "
  23. |     Change Log
  24. | ============================================================================
  25. | Author       Date       Change 
  26. | sbyrne     24 May 90      created.
  27. |
  28. "
  29.  
  30. Object subclass: #TextItem
  31.        instanceVariableNames: 'type delta string font'
  32.        classVariableNames: ''
  33.        poolDictionaries: ''
  34.        category: 'X Hacking'
  35. !
  36.  
  37. !TextItem class methodsFor: 'instance creation'!
  38.  
  39.  
  40. onString: aString
  41.     ^self new: aString delta: 0
  42. !
  43.  
  44. new: aString delta: anInteger
  45.     ^self new init: aString delta: anInteger
  46. !!
  47.  
  48.  
  49. !TextItem methodsFor: 'writing'!
  50.  
  51. emitTo: aPacket
  52.     type 
  53.     ifTrue:
  54.         [ aPacket byte: string size.
  55.           aPacket byte: delta.
  56.           aPacket bytes: string asByteArray ]
  57.     ifFalse:
  58.         [ aPacket byte: 255.
  59.           aPacket byte: font / (256 * 256 * 256).
  60.           aPacket byte: font / (256 * 256) \\ 256.
  61.           aPacket byte: font / (256) \\ 256.
  62.           aPacket byte: font \\ 256 ]
  63. !!
  64.  
  65. !TextItem methodsFor: 'private'!
  66.  
  67. init: aString delta: anInteger
  68.     type _ true.
  69.     string _ aString.
  70.     delta _ anInteger
  71. !!
  72.